﻿using UnityEngine;
using System.Collections;

public class AxonLink : MonoBehaviour {
	BrainCore core;

	void Awake(){
		core = transform.parent.gameObject.GetComponent<BrainCore> ();
	}

	// Use this for initialization
	void Start () {
		gameObject.GetComponent<MeshRenderer> ().enabled = BrainCore.DISPLAY_NODE;
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	void OnTriggerStay(Collider other)
	{
		
//		if (other.gameObject.name.Equals ("Axon")) {
//			Debug.Log ("AxonLink OnNodeTriggerStay" + other.gameObject.name);
//		}
		if (other.gameObject.name.StartsWith ("Tree")) {
			//Debug.Log ("AxonLink OnNodeTriggerStay Tree" + other.gameObject.name);
			core.OnNodeTriggerStay (other.transform.parent.gameObject.GetComponent<BrainCore>());
		}
	}
}
